package com.chenggcode.mpsamples.persistence.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.chenggcode.mpsamples.MpSamplesApplication;
import com.chenggcode.mpsamples.persistence.domain.handlers.JsonbFastjson2TypeHandler;
import com.chenggcode.mpsamples.persistence.domain.handlers.JsonbJacksonTypeHandler;
import lombok.Data;
import org.apache.ibatis.type.JdbcType;

import java.io.Serial;

/**
 * 包含jsonb字段的表
 *
 * @author chenggcode
 * @TableName tb_jsonb
 */
@TableName(value = "tb_jsonb", autoResultMap = true)
@Data
public class JsonbEntity extends Model<JsonbEntity> {
    /**
     * 主键id
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     *
     */
    @TableField(typeHandler = JsonbJacksonTypeHandler.class, jdbcType = JdbcType.OTHER)
    private JsonInfo jsonInfo1;

    /**
     *
     */
    @TableField(typeHandler = JsonbFastjson2TypeHandler.class, jdbcType = JdbcType.OTHER)
    private JsonInfo jsonInfo2;

    private Integer col1;

    @Serial
    @TableField(exist = false)
    private static final long serialVersionUID = 1L;



}